package com.tuozixuan;

import java.io.File;

import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import static com.tuozixuan.GitDemoConstants.*;

public class GitPushDemo {

	public static void main(String[] args) throws Exception {

		UsernamePasswordCredentialsProvider provider = new UsernamePasswordCredentialsProvider(USERNAME, PASSWORD);

		Git git = Git.open(new File(LOCAL_DIR));
		git.push().setRemote("origin").setCredentialsProvider(provider).setRefSpecs(new RefSpec(BRANCH_NAME)).call();
	}
}
